<template>
    <div>
        <h1>星火大模型测试</h1>
        <div ref="content"></div>
        <el-input ref="questionlnput" v-model="question.msg" placeholder="请输入提问内容"></el-input>
        <button @click="send">发送</button>
        <button ref="talkbutton">{{ btnStr }}</button>
        
    </div>
</template>

<script>
import createWss from "./sparkApi";
import initTalk from "../talk/newtalk.api";
import { test } from "@/api/bis/trafficTest";   //“@”表示项目的根目录。
export default {
    data() {
        return {
            question: {
                msg: "",
            },
            btnStr: "语音输入",
        };
    },
    mounted() {
        //初始化语音输入
        this.initTalkInput();
        test().then(resp=>{
            alert(resp.msg);
        })
    },
    methods: {
        send() {
            let div = this.$refs.content; //获取div的dom对象
            createWss(this.question.msg, div);
        },
        initTalkInput() {
            let talkbutton = this.$refs.talkbutton;
            initTalk(talkbutton, this.question);
        },
    },
};
</script>
